package com.xxc.common.util

import java.io.InputStream

object ExcelUtil{

    /**
     * 获取excel表格的数据
     */
    fun getSheetsData(input:InputStream,filename:String):Map<String,List<List<String>>> {
        val data = POIUtil.getBankListByExcel(input,filename)
        data.forEach{(key,list) ->
            val index = list[0].size - list[0].reversed().indexOfFirst {
                it != null && !it.isBlank() && it.isNotEmpty()
            }
            val mapped = list.map {
                it.subList(0, if (index > it.size) it.size else index)
            }
            data[key] = mapped
        }
        return data
    }
}